[POWERPC][XEN] Define all cache information globaly
authorJimi Xenidis <jimix@watson.ibm.com>
Thu, 14 Sep 2006 05:12:26 +0000 (01:12 -0400)
committerJimi Xenidis <jimix@watson.ibm.com>
Thu, 14 Sep 2006 05:12:26 +0000 (01:12 -0400)
Rather than use the config.h macro

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
xen/arch/powerpc/dart.c
xen/arch/powerpc/powerpc64/ppc970.c
xen/include/asm-powerpc/cache.h
xen/include/asm-powerpc/config.h

index 50d644122f9e296d669538c9bedc513006913925..0de55a58d71f4dfd304a87c4cd18e4be5ccf6e56 100644 (file)
@@ -114,7 +114,7 @@ static void dart_fill(ulong index, int perm, ulong rpg, ulong num_pg)
         ++rpg;
         if (i == num_pg) break;
 
-        if (((ulong)&entry[i]) % CACHE_LINE_SIZE == 0) {
+        if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) {
             last_flush = (ulong)&entry[i - 1];
             dcbst(last_flush);
         }
@@ -134,7 +134,7 @@ static void dart_clear(ulong index, ulong num_pg)
         ++i;
         if (i == num_pg) break;
 
-        if (((ulong)&entry[i]) % CACHE_LINE_SIZE == 0) {
+        if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) {
             last_flush = (ulong)&entry[i - 1];
             dcbst(last_flush);
         }
@@ -263,7 +263,7 @@ static int init_dart(void)
     /* Linux uses a dummy page, filling "empty" DART entries with a
        reference to this page to capture stray DMA's */
     dummy_page = (ulong)alloc_xenheap_pages(1);
-    memset((void *)dummy_page, 0, PAGE_SIZE);
+    clear_page((void *)dummy_page);
     dummy_page >>= PAGE_SHIFT;
 
     printk("Initializing DART 0x%lx: tbl: %p[0x%lx] entries: 0x%lx\n",
index d175b9a300e1c000c56ffb059938e2ae54e27fab..8a8de16e4c477b2c460c5a789f88c997db554c93 100644 (file)
 #undef DEBUG
 #undef SERIALIZE
 
+struct cpu_caches cpu_caches = {
+       .dline_size = 0x80,
+       .log_dline_size = 7,
+    .dlines_per_page = PAGE_SIZE >> 7,
+       .iline_size = 0x80,
+       .log_iline_size = 7,
+    .ilines_per_page = PAGE_SIZE >> 7,
+};
+
 struct rma_settings {
     int order;
     int rmlr_0;
index db1315dcf1c163c1253c43f878a1eadf70e1d9ee..7f5a89a0b0f7cff09e84f8db1ee09b1aaa632acb 100644 (file)
@@ -59,4 +59,15 @@ static __inline__ void synchronize_caches(ulong start, size_t len)
 
 #define __read_mostly
 
+struct cpu_caches {
+       u32     dsize;                  /* L1 d-cache size */
+       u32     dline_size;             /* L1 d-cache line size */
+       u32     log_dline_size;
+       u32     dlines_per_page;
+       u32     isize;                  /* L1 i-cache size */
+       u32     iline_size;             /* L1 i-cache line size */
+       u32     log_iline_size;
+       u32     ilines_per_page;
+};
+extern struct cpu_caches cpu_caches;
 #endif
index bfa59ed3e546c86cf56c76b948ec0e9e50a82d86..154938fe4df3624458019d593e3ff62660c73e56 100644 (file)
@@ -44,9 +44,6 @@ extern char __bss_start[];
 #define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
 #define ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
 
-/* this should be per processor, but for now */
-#define CACHE_LINE_SIZE 128
-
 /* 256M - 64M of Xen space seems like a nice number */
 #define CONFIG_MIN_DOM0_PAGES (192 << (20 - PAGE_SHIFT))
 #define CONFIG_SHADOW 1